Alexa Skills Projects by Madhur Bhargava

Alexa Skills Projects by Madhur Bhargava

Author:Madhur Bhargava
Language: eng
Format: epub
Tags: COM067000 - COMPUTERS / Hardware / General, COM074000 - COMPUTERS / Hardware / Mobile Devices, COM025000 - COMPUTERS / Expert Systems
Publisher: Packt Publishing
Published: 2018-07-02T07:43:24+00:00


if ("Answer" === intentName) {

handleAnswerRequest(intent, session, callback);

} else if ("AMAZON.StopIntent" === intentName) {

handleFinishSessionRequest(intent, session, callback);

} else {

throw "Invalid intent";

}

}

We shall first see the simpler of the two, which is AMAZON.StopIntent, raised once the user decides to prematurely end the skill's execution by saying a phrase such as "Alexa, Stop Factly." This causes handleFinishSessionRequest to be called:

function handleFinishSessionRequest(intent, session, callback) {

callback(session.attributes,

buildSpeechletResponse("Factly will Exit. Good bye!", "", true));

}

This says a goodbye phrase to the user before the Factly Skill exits.

The Answer intent request is a significantly more complicated one, as it has multiple information flow paths and is handled by the handleAnswerRequest method:

function handleAnswerRequest(intent, session, callback) {

var speechOutput = "";

var sessionAttributes = {};

var gameInProgress = session.attributes && session.attributes.questions;

var answerSlotValid = isAnswerSlotValid(intent);

var userGaveUp = intent.name === "DontKnowIntent";



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.